const URL = {
    parse: function parse(string) {
        if (string && string.length > 0) {
            const pathname = string.split('?')[0];
            const query = string.split('?')[1];
            const QueryArray = [];
            query && query.split('&').forEach((item) => {
                const obj = {};
                const value = item.split('=')[0];
                const key = item.split('=')[1];
                obj[key] = value;
                QueryArray.push(obj);
            });
            return { pathname, query, QueryArray };
        }
        return { pathname: string };
    },
};
export default URL;
